Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 8 - TCP/IP Services / TCP/IP Services Reference
Options


IP Options

You can use the options in this section with a protocol level of INET_IP. The IP_OPTIONS and IP_TOS options are association-related; the other IP options are not. The IP_REUSEADDR option may be negotiated in all endpoint states except T_UNINIT. The other options may be negotiated in all endpoint states except T_UNBND and T_UNINIT. They are read-only in state T_UNBND. A request for any of these options is an absolute requirement.

#define IP_OPTIONS         0x01  /* enable/disable options */
#define IP_TOS             0x02  /* set/get type of service */
#define IP_TTL             0x03  /* set/get time to live */
#define IP_REUSEADDR       0x04  /* bind multiple addresses to one port */
#define IP_DONTROUTE       0x10  /* bypass standard routing */
#define IP_BROADCAST       0x20  /* get permission to send broadcasts */
#define IP_HDRINCL         0x1002/* reserved */
#define IP_RCVOPTS         0x1005/* reserved */
#define IP_RCVDSTADDR      0x1007/* reserved */
#define IP_MULTICAST_IF    0x1010 /* set/get IP multicast interface */
#define IP_MULTICAST_TTL   0x1011 /* set/get multicast time to live */
#define IP_MULTICAST_LOOP  0x1012 /* set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP  0x1013 /* add an IP group membership */
#define IP_DROP_MEMBERSHIP 0x1014 /* drop an IP group membership */
#define IP_BROADCAST_IF    0x1015/* reserved */
#define IP_RCVIFADDR       0x1016/* reserved */
Possible flag values for the IP_TOS option are as follows:

/* IP_TOS precedence levels */
enum {
   T_ROUTINE      = 0,
   T_PRIORITY     = 1,
   T_IMMEDIATE    = 2,
   T_FLASH        = 3,
   T_OVERRIDEFLASH= 4,
   T_CRITIC_ECP   = 5,
   T_INETCONTROL  = 6,
   T_NETCONTROL   = 7
};
/* IP_TOS type of service */
enum {
   T_NOTOS        = 0x0,
   T_LDELAY       = (1<<4),
   T_HITHRPT      = (1<<3),
   T_HIREL        = (1<<2)
};
Option descriptions

IP_OPTIONS
Set the value of the Options field in the header of each outgoing IP datagram, or receive the Options field of each incoming IP datagram. This option is intended for use by network debugging and control programs; most applications do not need this option. Normally, you use Open Transport option management functions or configuration strings to set options. The option management functions are described in the chapter "Option Management" in this book, and configuration strings are described in the chapter "Configuration Management" in this book.
The value for this option consists of a string of octets whose formats follow the definitions of IP options in the current RFCs with one exception: If you specify a source routing option, the first address in the list of gateways must be for the first-hop gateway. Open Transport extracts the first-hop gateway address from the option list and adjusts the size of the list before transmitting the packet. The Options field can contain up to 40 octets.
To disable this option, specify an option header only with no option values. This option is enabled by default any time you use an Open Transport option-management function or a configuration string to set an IP option that must be negotiated.
If you enable IP_OPTIONS, the function OTOptionManagement with the T_CURRENT action flag set returns the list of IP options that are currently being sent with outgoing IP datagrams.
The functions OTConnect (in synchronous mode only), OTListen, OTRcvConnect, and OTRcvUData return the Options field of the received IP datagram. The OTRcvUDErr function returns the Options field of the previously sent datagram that caused the error.
IP_TOS
Set the Type of Service field of each outgoing IP datagram, or receive the Type of Service field of each incoming IP datagram. Open Transport hosts and routers ignore the Type of Service field, but you can set this value for use with other networks if you so desire. The data for this option is any combination of a Precedence flag and a Type of Service flag. Use the OR operator to combine the flags. The possible values for these flags are shown at the beginning of this section.
If you enable IP_TOS, the function OTOptionManagement with the T_CURRENT action flag set returns the Type of Service flags that are currently being sent with outgoing IP datagrams.
The functions OTConnect (in synchronous mode only), OTListen, OTRcvConnect, and OTRcvUData return the Type of Service field of the received IP datagram. The function OTRcvUDErr returns the Type of Service field of the previously sent datagram that caused the error.
IP_TTL
Set the Time to Live field of each outgoing IP datagram. Specify the number of hops as an unsigned char. Each router that processes the datagram decrements the Time to Live field and discards the datagram if the value reaches 0. The default value for this field is 255. Because this is not an association-related option, there is no function that returns the Time to Live field of an incoming datagram.
IP_REUSEADDR
Allow multiple addresses with the same port number. Set this option to T_YES to allow TCP to bind a transport endpoint to a wildcard address (that is, an address of 0) that includes a port number plus bind one or more additional endpoints to distinct fully specified internet addresses that include the same port number. If this option is set to T_NO (the default), TCP cannot bind two or more transport endpoints to addresses that include the same port number.
IP_DONTROUTE
Use addresses on connected subnets only. Set this option to T_YES to cause outgoing messages to be delivered to the local network only and not to go through any routers or gateways. (This options sets the time-to-live value to 1.) This option is intended for testing and development purposes. Specify T_NO to disable this option. This option is disabled by default.
IP_BROADCAST
Request permission to send broadcast datagrams. Set this option to T_YES to request permission to send broadcast datagrams. Specify T_NO to disable this option. This option is disabled by default.
IP_HDRINCL
Include the IP header with received data. Set this option to T_YES to cause RawIP to include the IP header when you read data. Set the option to T_NO (the default) to receive only the data without the header. This option works with the RawIP interface only.
IP_RCVOPTS
Include IP-level options when you call the OTRcvUData function. If you set this option to T_YES (the default), the OTRcvUData function returns IP-level options along with the UDP options when you are receiving UDP data. If you set this option to T_NO, you receive only UDP options.
IP_RCVDSTADDR
For multihomed systems, include with received data the address of the interface on which a message was received. If you specify this option to T_YES, the OTRcvUData function includes the address of the interface. If you specify this option to T_NO (the default), you receive only the data.
IP_MULTICAST_IF
Specify the TCP/IP interface to use for outgoing multicast IP datagrams, or retrieve the interface this option is set to. Specify the interface as a long (for example, if the address is "1.2.3.4", specify the address as 0x01020304). This option and the other multicast options can be used with UDP and RawIP only. In the case that a host is multihomed, this option lets you specify which network interface to use for multicasts. Whereas only one network interface can be used at a time for multicast transmissions, an application can join the same multicast group address on more than one network interface. If you joined the same multicast address on more than one network, this option lets you determine over which network the datagram arrived.
IP_MULTICAST_TTL
Set the Time to Live field for outgoing multicast IP datagrams, or retrieve the Time to Live field set for an interface. Each router that processes the datagram decrements the Time to Live field and discards the datagram if the value reaches 0. Specify the time to live as an unsigned char. To avoid unneccessary network traffic, you should set this value as low as possible. The default value is 1.
IP_MULTICAST_LOOP

Enable loopbacks for outgoing multicast IP datagrams. Set this option to T_YES to cause an outgoing multicast datagram to be delivered to yourself; set this option to T_NO to disable loopbacks. Loopbacks are enabled by default.
IP_ADD_MEMBERSHIP

Add a membership in an IP multicast group. You use a TIPAddMulticast structure to specify the address and network interface of the group you wish to join. The TIPAddMulticast structure is described in "IP Multicast Address Structure" on page 8-27.
IP_DROP_MEMBERSHIP

Drop membership in an IP multicast group. You use a TIPAddMulticast structure to specify the address and network interface of the group you wish to leave.
IP_BROADCAST_IF
Reserved.
IP_RCVIFADDR
Reserved.
The following IP-level options are reserved for use by Apple Computer, Inc.

#define  DVMRP_INIT     0x64
#define  DVMRP_DONE     0x65
#define  DVMRP_ADD_VIF  0x66
#define  DVMRP_DEL_VIF  0x67
#define  DVMRP_ADD_LGRP 0x68
#define  DVMRP_DEL_LGRP 0x69
#define  DVMRP_ADD_MRT  0x6A
#define  DVMRP_DEL_MRT  0x6B 

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996